package com.huangmb.anymark.app.activity.base;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.widget.ProgressBar;
import com.huangmb.androidlib.activity.BaseActivity;
import com.huangmb.anymark.app.R;
import com.huangmb.anymark.app.app.AnyMarkApplication;
import com.huangmb.anymark.app.net.RequestManager;

/**
 * @author hmb
 * @version 1.0
 * @since 2016/4/14 21:07
 */
public abstract class AppBaseActivity extends BaseActivity {
    protected ProgressBar mProgressBar;
    public static final int REQUEST_LOGIN = 0;
    @Override
    protected void onInitView(Bundle savedInstanceState) {

    }

    @Override
    protected void beforeInitView(Bundle savedInstanceState) {

    }

    @Override
    protected void afterInitView(Bundle savedInstanceState) {
        mProgressBar = (ProgressBar) findViewById(R.id.progress);
    }

    public ProgressBar getProgressBar(){
        return mProgressBar;
    }

    @Override
    public final void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
    }

    public boolean hasLogin(){
        return AnyMarkApplication.getInstance().getUserContext() != null;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RequestManager.getInstance().cancelAllRequest();
    }
}
